<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="box1"></div>

  <script src="./lib/art-template-v4.13.2.js"></script>
  <script src="./lib/jquery-v3.6.0.js"></script>
  <script type="text/html" id="temp1">
    <p>{{value}}</p>
    <p>{{data.key}}</p>
    <p>{{data['key']}}</p>
    <p>{{a ? b : c}}</p>
    <p>{{a || b}}</p>
    <p>{{b + c}}</p>
  </script>
  <script>
    $(function () {
      // 定义数据源
      const obj = {
        value: '黑马程序员',
        data: { key: '前端高级工程师' },
        a: 0,
        b: 1,
        c: 2
      }

      const htmlStr = template('temp1', obj)
      $('#box1').html(htmlStr)
    })
  </script>
</body>

</html>